function [phiNew, torqIncrement] = RKstepperDVs(phi, deltaT, stateFuncHandle, DVs, setPoint, wind, conTor)
%RKstepper.m
%Numerical integration step using Runga-Kutta 2nd order method
%Inputs:
    %x = state variables, 
    %deltaT = time step
    %stateHandle = handle for the state equation function
    %tau = torque (or force) for computing the state
%Output: 
    %xnew = state variables at time t plus deltaT

[xdot, torqInc] = stateFuncHandle(phi, DVs, setPoint,  wind, conTor);
deltax = deltaT*xdot;
[xdot2, torqInc2] = stateFuncHandle(phi + deltax, DVs, setPoint, wind, conTor);
phiNew = phi + 0.5*deltaT*(xdot + xdot2);
torqIncrement = (torqInc + torqInc2)/2; % Assumes that the torque increment required to get there is the average.
